﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Fitts__law_experiment_with_a_wiimote
{
	public partial class Experiment2D : Fitts__law_experiment_with_a_wiimote.ExperimentForm
	{
		private Random rand = new Random();
		public Experiment2D()
		{
			InitializeComponent();
			SetExperiment(new Experiment("Random 2D", PrimaryButton, SecondaryButton));
		}

		private void Experiment2D_Load(object sender, EventArgs e)
		{
			
		}

		protected override void onMousePrimaryButtonClick()
		{
			int offsetW = (int)(this.Width * 0.1);
			int offsetH = (int)(this.Height * 0.1);
			int maxWidth = this.Width - offsetW * 2;
			int maxHeight = this.Height - offsetH * 2;
			SecondaryButton.Width = rand.Next(75, 250);
			SecondaryButton.Height = rand.Next(75, 225);

			SecondaryButton.Left = offsetW + rand.Next(maxWidth / 2, maxWidth - SecondaryButton.Width);
			SecondaryButton.Top = offsetH + rand.Next(0, maxHeight  - SecondaryButton.Height);
		}

		protected override void onMouseSecondaryButtonClick()
		{
			int offsetW = (int)(this.Width * 0.1);
			int offsetH = (int)(this.Height * 0.1);
			int maxWidth = this.Width - offsetW * 2;
			int maxHeight = this.Height - offsetH * 2;
			PrimaryButton.Width = rand.Next(75, 250);
			PrimaryButton.Height = rand.Next(75, 225);

			PrimaryButton.Left = offsetW + rand.Next(0, maxWidth / 2 - PrimaryButton.Width);
			PrimaryButton.Top = offsetH + rand.Next(0, maxHeight - PrimaryButton.Height);
		}
	}
}
